package com.gupaoedu.baifc.singleton;

/**
 * projectName: baifc_singleton
 * packageName: com.gupaoedu.baifc.singleton
 * Created: 2019/3/12.
 * Auther: baifc
 * Description: 静态内部类单例
 */
public class InnerStaticSingleton {

    private InnerStaticSingleton() {
        if (LazyHolder.LAZY != null) {
            throw new RuntimeException("不允许创建多个实例！");
        }
    }

    public static InnerStaticSingleton getInstance() {
        return LazyHolder.LAZY;
    }

    private static class LazyHolder {

        private static final InnerStaticSingleton LAZY = new InnerStaticSingleton();
    }
}
